package com.Windows;

import com.Windows.Window;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        List <Window> Windows = new ArrayList<>();
        Scanner sc = new Scanner(System.in);
        //窗口数
        int N = sc.nextInt();
        //点击数
        int M = sc.nextInt();
        //循环获取window存入list
        for (int i = 1; i <= N; i++) {
            int x1 = sc.nextInt();
            int y1 = sc.nextInt();
            int x2 = sc.nextInt();
            int y2 = sc.nextInt();
            Window window = new Window(i,x1,y1,x2,y2);
            Windows.add(window);
        }

        for (int i = 0; i < M; i++) {
            int x = sc.nextInt();
            int y = sc.nextInt();
            int j = Windows.size() - 1;

            for (; j >= 0; j--) {
                Window window = Windows.get(j);
                if(window.bInWindow(x,y)){
                    System.out.println(window.no);
                    Windows.remove(j);
                    Windows.add(window);
                    break;
                }
            }
            if(j < 0){
                System.out.println("IGNORED");
            }
        }

    }
}
